package iedcyt.acute.controller.listeners.authorMerge;

import iedcyt.acute.model.AuthorMergeModel;
import iedcyt.acute.view.AuthorMergeView;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

public class NextSelectionListener extends SelectionAdapter {

	private AuthorMergeModel _model;
	private AuthorMergeView _view;
	
	public NextSelectionListener(AuthorMergeView view, AuthorMergeModel model) {
		this._model = model;
		this._view = view;
	}
	
	public void widgetSelected(SelectionEvent event) {
		_model.nextPage();
		
		_view.loadAuthors(_model.getAuthors());
		_view.loadCandidateAuthors(_model.getCandidates());
		_view.loadAuthorDocuments(_model.getAuthorDocs());
		_view.loadCandidateDocuments(_model.getCandidateDocs());
		_view.loadAuthorCenters(_model.getAuthorCenters(), _model.isAuthorCentersWarning());
		_view.loadCandidateCenters(_model.getCandidateCenters(),_model.isCandidatCentersWarning());
		_view.loadAuthorCorps(_model.getAuthorCorps(), _model.isAuthorCorpsWarning());
		_view.loadCandidateCorps(_model.getCandidateCorps(), _model.isCandidateCorpsWarning());
		_view.loadAuthorSigns(_model.getAuthorSigns());
		_view.loadCandidateSigns(_model.getCandidateSigns());
		_view.loadAuthorSignsCollaborators(_model.getAuthorCollSigns());
		_view.loadCandidateSignsCollaborators(_model.getCandidateCollSigns());
		_view.loadAuthorAuthorsCollaborators(_model.getAuthorCollAuthors());
		_view.loadCandidateAuthorsCollaborators(_model.getCandidateCollAuthors());

		_view.compareTables();
	}
}
